<template>
  <div class="dashboard-editor-container">

    <panel-group @handleSetLineChartData="handleSetLineChartData" />

    <el-row style="background:#fff;padding:16px 24px;margin-bottom:32px;border-radius: 10px">
      <!--      <line-chart :chart-data="lineChartData" />-->
      <qjList/>
    </el-row>

<!--    <el-row :gutter="32">-->
<!--      <el-col :xs="24" :sm="24" :lg="12">-->
<!--        <div class="wzxBox" @dblclick="dbclick" @click="toInfo('qualityglxt/zlgckz/zljygl/NcQualityInspectionOrder')">-->
<!--          <div class="title" style="color: deepskyblue">未质检数量</div>-->
<!--          <div class="num">{{sydata.wzjNum}}</div>-->
<!--        </div>-->
<!--      </el-col>-->
<!--      <el-col :xs="24" :sm="24" :lg="12">-->
<!--        <div class="wzxBox" @dblclick="dbclick" @click="toInfo('warehousmasys/rukumanage/rukuInfoSelect')">-->
<!--          <div class="title" style="color: #00a680">未上架数量</div>-->
<!--          <div class="num">{{sydata.wsjNum}}</div>-->
<!--        </div>-->
<!--      </el-col>-->
<!--    </el-row>-->


  </div>
</template>

<script>
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
import qjList from './dashboard/qjList'
// import { listCcPurchaseReceipt } from "@/api/business/CcPurchaseReceipt";
import { listNcQualityInspectionOrder } from "@/api/business/NcQualityInspectionOrder";
import { listRukuInfo } from "@/api/business/rukuInfo";

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  name: 'Index',
  components: {
    PanelGroup,
    LineChart,
    RaddarChart,
    PieChart,
    BarChart,
    qjList
  },
  data() {
    return {
      sydata:{

      },
      queryParams1: {
        pageNum: 1,
        pageSize: 9999999,
      },
      queryParams2: {
        pageNum: 1,
        pageSize: 9999999,
        inspectionStatus:"0",
      },
      queryParams3: {
        pageNum: 1,
        pageSize: 9999999,
        qualityState: "1",
        sjState: "0",
      },
      lineChartData: lineChartData.newVisitis
    }
  },
  created() {
    // listCcPurchaseReceipt(this.queryParams1).then(res=>{
    //   let bjArr = res.rows.filter(item=>{
    //     return (item.shQuantity-0)<(item.quantity-0)
    //   })
    //   this.sydata.wshNum = bjArr.length
    //   this.$forceUpdate()
    // })
    listNcQualityInspectionOrder(this.queryParams2).then(res=>{
      this.sydata.wzjNum = res.rows.length
      this.$forceUpdate()
    })
    listRukuInfo(this.queryParams3).then(res=>{
      this.sydata.wsjNum = res.rows.length
      this.$forceUpdate()
    })
  },
  methods: {
    //入库 出库 排产 配送
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    },
    dbclick() {
      clearTimeout(this.time)
      // 双击事件 不写不执行，禁用
    },
    toInfo(type) {
      let that = this
      // 开启延时器，200ms的间隔用来区分单击和双击，解决双击时执行两次单击事件
      clearTimeout(that.time)
      that.time = setTimeout(() => {
        this.$router.push({path:type})
      },200)
    },
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
//.wzxBox{
//  display: flex;
//  height: 380px;
//  background: #fff;
//  border-radius: 10px;
//  flex-direction: column;
//  align-items: center;
//  justify-content: center;
//  cursor: pointer;
//  .title{
//    /*font-weight: 550;*/
//    font-size: 30px;
//  }
//  .num{
//    font-weight: 550;
//    font-size: 40px;
//    color: red;
//  }
//}
</style>
